from pathlib import Path
from importlib import import_module

def load_plugins():
    """动态加载所有插件"""
    plugins = []
    plugins_dir = Path(__file__).parent / "plugins"
    
    for plugin_file in plugins_dir.glob("*/adapter.py"):
        module_name = f"plugins.{plugin_file.parent.name}.adapter"
        try:
            module = import_module(module_name)
            if hasattr(module, "MirrorPlugin"):
                plugins.append(module.MirrorPlugin)
        except Exception as e:
            continue
            
    return plugins# core/plugin_loader.py
from pathlib import Path
from importlib import import_module

def load_plugins():
    """动态加载所有插件"""
    plugins = []
    plugins_dir = Path(__file__).parent / "plugins"
    
    for plugin_file in plugins_dir.glob("*/adapter.py"):
        module_name = f"plugins.{plugin_file.parent.name}.adapter"
        try:
            module = import_module(module_name)
            if hasattr(module, "MirrorPlugin"):
                plugins.append(module.MirrorPlugin)
        except Exception as e:
            continue
            
    return plugins